package cn.wildfirechat.app.update.dto;

import lombok.Data;

@Data
public class ResultVo<T> {
    private String code;
    private String msg;
    private T data;

    public static <T> ResultVo<T> success(T data) {
        ResultVo<T> response = new ResultVo<>();
        response.setCode("200");
        response.setMsg("success");
        response.setData(data);
        return response;
    }
    
    public static <T> ResultVo<T> error(String code, String message) {
        ResultVo<T> response = new ResultVo<>();
        response.setCode(code);
        response.setMsg(message);
        return response;
    }

    public static <T> ResultVo<T> error( String message) {
        ResultVo<T> response = new ResultVo<>();
        response.setCode("1001");
        response.setMsg(message);
        return response;
    }
}